<?php
 require "model/message.model.php";
 session_start();
 $message = $_POST["content"];
 $kid = $_POST["kid"];
 $id = $_POST["id"];
 $title = $_POST["title"];
 $flag = 0;
 $time = time();
if(!empty($_SESSION['username'])){
 $username = $_SESSION['username'];
 $str=messageAdd::addmessage($username,$id,$time,$message,$title,$flag);//添加留言
 if($str){	
	echo "<script> alert('留言成功,等待管理员的审核通过后即可查看');parent.location.href='article.php?id=$id&&kid=$kid';</script>"; 
 }else{	
	echo "<script> alert('留言失败');parent.location.href='article.php?id={$id}&&kid={$kid}';</script>"; 
 }
}
else{	
    echo "<script> alert('您还没有登入');parent.location.href='article.php?id={$id}&&kid={$kid}';</script>";   
}


?>
